<template>
	<view id="content">
		<view class="installer_item" v-for="(item,index) in installer_list" :key="item.id" @click.stop="onSelInstaller(item)">
			<view>姓名：{{item.name || '暂未填写'}}</view>
			<view style="margin: 16rpx 0 0 0;color: #888;">电话：{{item.tel}}</view>
			<view style="margin: 16rpx 0 0 0;color: #888;">地区：{{item.area || '未填写'}}</view>
			<view style="height: 1rpx;width: 100%;background-color: #ddd;margin: 16rpx 0 0 0;"></view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				installer_list: [],
			}
		},

		mounted() {
			this.getInstallerList()
		},

		methods: {

			// 点击选择安装人员
			onSelInstaller(item) {
				uni.$emit('onSelInstaller', { msg: item })
				uni.navigateBack()
			},

			// 接口:安装人员列表
			async getInstallerList() {
				this.install_list = []
				let that = this
				uni.showLoading({ title: '处理中', mask: true, })
				let res = await this.$installerList()
				// console.log('$installerList.res =', res);
				if (res.code == 1) {
					this.installer_list = res.data
				} else {
					this.$toast(res.msg)
				}
			},
		}
	}
</script>

<style scoped>
	#content {
		width: 100%;
		height: 100%;
		display: flex;
		flex-direction: column;
	}

	.installer_item {
		display: flex;
		flex-direction: column;
		margin: 20rpx;
		font-size: 28rpx;
	}
</style>